package asciiTablePrinting;

import java.util.ArrayList;

public class ASCIIDoubleColumn extends ASCIITableColumn {

	private int precision=0;
	private int exponent;
	
	private ArrayList<Double> entries;

	
	
	/**
	 * @param entries the column entries line by line
	 * @param columnWidth width of column
	 * @param precision positions after decimal point
	 */
	public ASCIIDoubleColumn(ArrayList<String> headlines,ArrayList<Double> entries,int exponent, int precision,int columnWidth) {
		super(headlines, columnWidth);
		this.exponent=exponent;
		this.precision=precision;
		this.entries=entries;
	}

	
	@Override
	public String getEntry(int lineNumber) {
		double entry=entries.get(lineNumber)/Math.pow(10, this.exponent);
		return String.format("%"+columnWidth+"."+precision+"f", entry);
	}

	@Override
	public int getEntryCount() {
		return entries.size();
	}

	public void setEntries(ArrayList<Double> entries) {
		this.entries = entries;
	}

}
